﻿@using PAMD
@using PAMD.Business.Models
@model PAMD.Business.Models.ProfileModel
@{
    ViewBag.Title = SiteConstant.Slogan;
    Layout = "../Shared/_Layout.cshtml";
}
@using (Html.BeginForm("Edit", "Profile"))
{
    <div class="form-container-small">
        <strong>@string.Format("{0}'s profile", Model.UserDetail.FirstName)</strong>
        <fieldset class="field-container">
            <div>
                @if (ViewBag.Error != null && ViewBag.Error != "")
                {
                    <div class="blue-box">
                        @ViewBag.Error
                    </div>
                }
                <div class="left-align">
                    <div class="controlBox">
                        <div class="smallLabel">
                            E-Mail :&nbsp;</div>
                        <div class="left-align">@Model.UserDetail.Email</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                         <div class="smallLabel">
                            First name :&nbsp;</div>
                        <div class="left-align">@Model.UserDetail.FirstName</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                        <div class="smallLabel">
                            Last name :&nbsp;</div>
                        <div class="left-align">@Model.UserDetail.LastName</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                         <div class="smallLabel">
                            Contact number :&nbsp;</div>
                        <div class="left-align">
                            @if (string.IsNullOrEmpty(Model.UserDetail.ContactNumber))
                            {
                                @Html.ActionLink("Add", "Edit", "Profile");
                            }
                            else
                            {
                                @Model.UserDetail.ContactNumber
                            }</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                         <div class="smallLabel">
                            Mobile :&nbsp;</div>
                        <div class="left-align">
                            @if (string.IsNullOrEmpty(Model.UserDetail.Mobile))
                            {
                                @Html.ActionLink("Add", "Edit", "Profile");
                            }
                            else
                            {
                                @Model.UserDetail.Mobile
                            }</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                         <div class="smallLabel">
                            Address :&nbsp;</div>
                        <div class="left-align">
                            @if (Model.Address == null)
                            {
                                @Html.ActionLink("Add", "Edit", "Profile");
                            }
                            else
                            {
                                var address = Model.Address;
                                @address.Line1<br />
                                @address.Line2<br />
                                @address.City <br />
                                @address.County<br />
                                @address.PostCode<br />
                                if (!string.IsNullOrEmpty(address.Country))
                                {
                                @Model.Countries.Find(c => c.Value == address.Country).Text;
                                }
                            }</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                         <div class="smallLabel">
                            Date of birth :&nbsp;</div>
                        <div class="left-align">
                            @if (Model.UserDetail.DateOfBirth == null)
                            {
                                @Html.ActionLink("Add", "Edit", "Profile");
                            }
                            else
                            {
                                @Model.UserDetail.DateOfBirth.Value.ToString("dd-MM-yyyy")                                    
                            }</div>
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                        <div class="smallLabel">
                            Occupation :&nbsp;</div>
                        <div class="left-align">
                            @if (string.IsNullOrEmpty(Model.UserDetail.Occupation))
                            {
                                @Html.ActionLink("Add", "Edit", "Profile");
                            }
                            else
                            {
                                @Model.OccupationText                                    
                            }</div>
                    </div>
                </div>
                <div class="left-align">
                    <label for="">
                        &nbsp;
                    </label>
                    <input type="submit" id="EditButton" style="margin-left: 100px;" value="Change Details" />
                </div>
            </div>
        </fieldset>
    </div>
}